/*
 ============================================================================
 Name        : Parser.c
 Author      : mattia
 Version     :
 Copyright   : Your copyright notice
 Description : Compute Pi in MPI C++
 ============================================================================
 */
#include <math.h> 
#include "mpi.h" 
#include <iostream>

#include "Utils.h"
#include "DppmParams.h"

using namespace std;
 
int main(int argc, char *argv[]) {
	int numAct,	T;
	int* numPreds;
	int* numModes;
	int** Preds;
	int** ModesCosts;
	int** ModesTimes;

	printf("argv[1]: \"%s\"\n", argv[1]);

	if ((argc != 2) || readDppmSpec(argv[1],numAct,T,numPreds,Preds,numModes,ModesCosts,ModesTimes)){
			printf("Error!!\n");
			return -1;
	}

	DppmParams dppm;
	InitializeDppm(dppm,numAct,T,numPreds,Preds,numModes,ModesCosts,ModesTimes);

	for (int i = 0; i < GetNumActivities(dppm); i++){
		printf("---------Act %d---------\n", i);

		printf("    Preds:\n          ");
		int * preds = GetActivityPreds(dppm, i);
		for(int j = 0; j < GetActivityNumPreds(dppm,i); j++){
			printf("%d ", preds[j]);
		}
		printf("\n");

		printf("    Modes(cost,time):\n          ");
		int * costs = GetActivityModesCosts(dppm, i);
		int * times = GetActivityModesTimes(dppm, i);
		for(int j = 0; j < GetActivityNumModes(dppm,i); j++){
			printf("(%d,%d) ", costs[j], times[j]);
		}
		printf("\n");

		printf("------------------------\n");
	}


	return 0;
}


